Skip to content

NO-JIRA: perses automation testing fixes after project selector fixes#833

Open
etmurasaki wants to merge 1 commit intoopenshift:mainfrom
etmurasaki:etmura-perses-fix
Open

NO-JIRA: perses automation testing fixes after project selector fixes#833
etmurasaki wants to merge 1 commit intoopenshift:mainfrom
etmurasaki:etmura-perses-fix

Conversation

@etmurasaki
Copy link
Contributor

@etmurasaki etmurasaki commented Mar 11, 2026

Summary by CodeRabbit

  • Tests
    • Improved test stability, reordered assertions, and added project-dropdown checks across dashboard Create/Duplicate/Import flows.
    • Adjusted navigation steps in test setup to make UI navigation more reliable.
  • Bug Fixes
    • Success alert after saving no longer auto-closes so confirmations remain visible.
    • Error and validation messages reworded for clearer, user-facing prefixes.
  • Style
    • Dashboard metadata tags normalized to lowercase for consistent display.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 11, 2026
@openshift-ci-robot
Copy link

@etmurasaki: This pull request explicitly references no jira issue.

Details

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 11, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: etmurasaki

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

📝 Walkthrough

Walkthrough

Added preliminary navigation steps in multiple RBAC tests, applied dialog-scoped selectors and updated test IDs/selectors, adjusted validation and import/error messages, normalized fixture tags to lowercase, tweaked support test flows and assertions, and simplified one page-object method signature.

Changes

Cohort / File(s) Summary
RBAC test navigation additions
web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts, web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts, web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts, web/cypress/e2e/perses/99.coo_rbac_perses_user4.cy.ts, web/cypress/e2e/perses/99.coo_rbac_perses_user5.cy.ts, web/cypress/e2e/perses/99.coo_rbac_perses_user6.cy.ts
Inserted an extra beforeEach navigation step to click Observe > Dashboards before Observe > Dashboards (Perses) in RBAC test setups.
Support test flow tweaks
web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts, web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts, web/cypress/support/perses/99.coo_rbac_perses_user3.cy.ts, web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts, web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts
Reordered and relocated project-dropdown existence assertions, removed some closeSuccessAlert() calls after deletes, fixed a stray trailing character, and replaced some direct filter clearing with side-navigation steps.
Page object scoping & assertions
web/cypress/views/perses-dashboards-create-dashboard.ts, web/cypress/views/perses-dashboards-import-dashboard.ts, web/cypress/views/perses-dashboards-list-dashboards.ts, web/cypress/views/perses-dashboards.ts
Scoped dropdown/error selectors to dialog context (cy.byPFRole('dialog').find(...)), changed several assertion targets, removed an automatic success-alert close after Save, and adjusted import/dashboard error visibility checks.
Selectors / test IDs changed
web/src/components/data-test.ts
Updated test ID for dashboard-name input and the project-dropdown selector; added a new selector PersesDuplicateDashboardNameError.
Constants / validation messages
web/cypress/fixtures/perses/constants.ts
Reworded validation and import/migration messages, added DIALOG_DUPLICATED_NAME_PF_VALIDATION_SUFFIX_PROJECT, and prefixed some errors with explicit "Error ..." text.
Fixture normalization
web/cypress/fixtures/coo/coo141_perses/import/acm-vm-status.json
Normalized metadata tags from capitalized to lowercase (ACMacm, KubeVirtkubevirt, OpenShiftopenshift, Virtualizationvirtualization).
Page-object signature change
web/cypress/views/perses-dashboards-create-dashboard.ts
Simplified method signature: assertDuplicatedNameValidation(dashboardName: string)assertDuplicatedNameValidation().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through dialogs, scoped and neat,

Clicked dashboards twice to set the beat.
Tags made humble, messages refined,
Assertions shuffled, selectors aligned.
A happy rabbit cheers the test-suite fleet 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixes to perses automation tests that were necessitated by project selector fixes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts (1)

66-67: Extract the two-step Perses navigation into one helper.

This exact sequence now appears across all 99.coo_rbac_perses_user{1..6}.cy.ts specs. Wrapping it in something like nav.sidenav.openPersesDashboards() would keep future route fixes in one place.

♻️ Suggested cleanup
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    nav.sidenav.openPersesDashboards();
// web/cypress/views/nav.ts
openPersesDashboards: () => {
  nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
  nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts` around lines 66 - 67,
Extract the repeated two-step navigation into a single helper method on the nav
view: create a function named openPersesDashboards (e.g.,
nav.sidenav.openPersesDashboards) that calls
nav.sidenav.clickNavLink(['Observe', 'Dashboards']) then
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']), and replace the
two-line sequences in all 99.coo_rbac_perses_user{1..6}.cy.ts specs with a
single call to nav.sidenav.openPersesDashboards() so future route changes are
centralized.
web/cypress/views/perses-dashboards-create-dashboard.ts (1)

65-69: Drop the new fixed pause before clicking Cancel.

The button is already gated by should('be.visible'), so the extra cy.wait(2000) only adds suite latency and still leaves the interaction time-based instead of state-based.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts` around lines 65 -
69, In createDashboardDialogCancelButton remove the pre-click fixed pause (the
cy.wait(2000) immediately before the .byPFRole('dialog')...click call) and rely
on the existing should('be.visible') assertion for a state-based interaction;
leave the rest of the method unchanged so the click uses the visibility guard
instead of a time-based wait.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts`:
- Around line 479-494: The test is filtering/deleting using a hard-coded prefix
('Testing Dashboard - UP') which can match multiple dashboards; change the flow
to use the exact generated dashboard name stored in suite scope (e.g. a variable
created when the dashboard is made) and pass that variable to
listPersesDashboardsPage.filter.byName(generatedName) and to the delete action;
instead of listPersesDashboardsPage.clickKebabIcon() use a row-scoped action
(e.g. clickKebabForDashboard(generatedName) or locate the row by name before
clicking) so the kebab targets the exact row, and update countDashboards
assertions to expect '1'/'0' against that exact name. Ensure the generatedName
is accessible where the delete steps run (store in outer describe or
create+delete in the same it).

In `@web/cypress/views/perses-dashboards-import-dashboard.ts`:
- Around line 101-108: The assertions assertFailedToMigrateGrafanaDashboard and
assertDuplicatedDashboardError currently use cy.get('h4') which is too broad;
scope them to the alert component instead (e.g., use cy.get('[role="alert"]') or
your alert class) and then check the heading text inside that alert (for
example, cy.get('[role="alert"]').contains('h4',
persesDashboardsImportDashboard.DIALOG_FAILED_TO_MIGRATE_GRAFANA_DASHBOARD').should('be.visible')
and similarly for DIALOG_DUPLICATED_DASHBOARD_ERROR) so the match is constrained
to the alert component.

In `@web/src/components/data-test.ts`:
- Line 221: The selector PersesCreateDashboardProjectDropdown uses an exact
class-match string which is brittle; replace it with a standard class selector
(e.g., button.pf-v6-c-menu-toggle__button or just .pf-v6-c-menu-toggle__button)
wherever PersesCreateDashboardProjectDropdown is defined/used so it tolerates
additional classes and order changes—update the definition in
web/src/components/data-test.ts and replace all 13 usages across the Cypress
helpers (create, duplicate, import) to reference the new class-style selector.

---

Nitpick comments:
In `@web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts`:
- Around line 66-67: Extract the repeated two-step navigation into a single
helper method on the nav view: create a function named openPersesDashboards
(e.g., nav.sidenav.openPersesDashboards) that calls
nav.sidenav.clickNavLink(['Observe', 'Dashboards']) then
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']), and replace the
two-line sequences in all 99.coo_rbac_perses_user{1..6}.cy.ts specs with a
single call to nav.sidenav.openPersesDashboards() so future route changes are
centralized.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts`:
- Around line 65-69: In createDashboardDialogCancelButton remove the pre-click
fixed pause (the cy.wait(2000) immediately before the
.byPFRole('dialog')...click call) and rely on the existing should('be.visible')
assertion for a state-based interaction; leave the rest of the method unchanged
so the click uses the visibility guard instead of a time-based wait.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f57fe68d-cda1-40c6-a1d1-6480b2a0fdc9

📥 Commits

Reviewing files that changed from the base of the PR and between 4b2ccc0 and 337dbdc.

📒 Files selected for processing (16)
  • web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user4.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user6.cy.ts
  • web/cypress/fixtures/coo/coo141_perses/import/acm-vm-status.json
  • web/cypress/fixtures/perses/constants.ts
  • web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/views/perses-dashboards-create-dashboard.ts
  • web/cypress/views/perses-dashboards-import-dashboard.ts
  • web/cypress/views/perses-dashboards-list-dashboards.ts
  • web/src/components/data-test.ts

});

beforeEach(() => {
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we need to click on legacy dashboards to test perses. Is it some reset step missing?

cy.log(`5.5. Click on the Kebab icon - Delete`);
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);s
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the testing files being excluded from typescript and lint checks? This should have been caught by the ts compiler.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts (1)

479-494: ⚠️ Potential issue | 🟠 Major

Use the exact generated dashboard name for delete cleanup (not a shared prefix).

Line 480 and Line 493 still filter by 'Testing Dashboard - UP', which can match multiple leftover dashboards and make delete/counter assertions flaky.

🛠️ Suggested fix
+let createdDashboardName = '';

 it(`5.${perspective.name} perspective - Create Dashboard with panel groups, panels and variables`, () => {
-  let dashboardName = 'Testing Dashboard - UP ';
-  let randomSuffix = Math.random().toString(5);
-  dashboardName += randomSuffix;
+  createdDashboardName = `Testing Dashboard - UP ${Math.random().toString(36).slice(2, 10)}`;
@@
-  persesCreateDashboardsPage.enterDashboardName(dashboardName);
+  persesCreateDashboardsPage.enterDashboardName(createdDashboardName);
@@
 });

 it(`9.${perspective.name} perspective - Delete dashboard`, () => {
+  expect(createdDashboardName, 'created dashboard name').to.not.equal('');
@@
-  listPersesDashboardsPage.filter.byName('Testing Dashboard - UP');
+  listPersesDashboardsPage.filter.byName(createdDashboardName);
@@
-  listPersesDashboardsPage.filter.byName('Testing Dashboard - UP');
+  listPersesDashboardsPage.filter.byName(createdDashboardName);
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts` around lines 479 -
494, The test is filtering and deleting using the shared prefix 'Testing
Dashboard - UP', which can match multiple dashboards and make assertions flaky;
update both calls to listPersesDashboardsPage.filter.byName(...) (lines
filtering before delete and final verify) to use the exact generated dashboard
name variable used when the dashboard was created (e.g., createdDashboardName or
dashboardName) instead of the hardcoded prefix, ensuring
listPersesDashboardsPage.countDashboards(...) and subsequent delete steps
(clickKebabIcon, clickDeleteOption, deleteDashboardDeleteButton, emptyState)
operate on the single intended dashboard.
🧹 Nitpick comments (2)
web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts (1)

73-76: Extract repeated “return to Dashboards (Perses)” navigation into one helper.

The same two-step nav sequence is duplicated in two places. A small local helper will reduce drift and keep future fixes in one place.

♻️ Suggested refactor
 export function testCOOListPersesNamespace(perspective: PerspectiveConfig) {
+  const returnToPersesDashboards = () => {
+    nav.sidenav.clickNavLink(['Observe', 'Alerting']);
+    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    listPersesDashboardsPage.shouldBeLoaded();
+  };

   it(`1.${perspective.name} perspective - List Dashboards (Perses) page`, () => {
@@
-    nav.sidenav.clickNavLink(['Observe', 'Alerting']);
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    returnToPersesDashboards();

     cy.log(`1.11. Click on a dashboard`);
@@
   it(`2.${perspective.name} perspective - Duplicate from a project to another, Rename and Delete`, () => {
@@
-    nav.sidenav.clickNavLink(['Observe', 'Alerting']);
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    returnToPersesDashboards();

Also applies to: 125-126

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts` around
lines 73 - 76, The duplicated two-step navigation using
nav.sidenav.clickNavLink(['Observe', 'Alerting']) followed by
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']) should be extracted
into a small helper (e.g., returnToDashboardsPerses or goToDashboardsPerses) and
called from both places where it repeats; update the calls that currently
perform the two-step sequence (the lines invoking nav.sidenav.clickNavLink with
['Observe','Alerting'] and ['Observe','Dashboards (Perses)']) to a single call
to the new helper to centralize the behavior and reduce duplication.
web/cypress/views/perses-dashboards-create-dashboard.ts (1)

67-69: Replace hard-coded waits with explicit UI state assertions.

Lines 67 and 69 use arbitrary 2-second delays that slow tests and mask synchronization issues. The pre-click wait (line 67) is redundant since the cancel button already checks .should('be.visible') before clicking. Replace both waits with assertions that verify the dialog closes or expected state changes—for example, wait for the dialog to disappear or confirm that submit/cancel actions complete.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts` around lines 67 -
69, Replace the two hard-coded cy.wait(2000) calls by relying on explicit UI
assertions: keep the existing
cy.byPFRole('dialog').find('button').contains('Cancel').should('be.visible').click({
force: true }) but remove the pre-click wait, and after the click assert the
dialog has closed (e.g., cy.byPFRole('dialog').should('not.exist') or
should('not.be.visible')) or assert the expected post-cancel state (a specific
element appears/disappears or URL changes) so the test synchronizes on UI state
instead of timeouts; update the code referencing cy.byPFRole('dialog') and the
Cancel button accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts`:
- Around line 479-494: The test is filtering and deleting using the shared
prefix 'Testing Dashboard - UP', which can match multiple dashboards and make
assertions flaky; update both calls to
listPersesDashboardsPage.filter.byName(...) (lines filtering before delete and
final verify) to use the exact generated dashboard name variable used when the
dashboard was created (e.g., createdDashboardName or dashboardName) instead of
the hardcoded prefix, ensuring listPersesDashboardsPage.countDashboards(...) and
subsequent delete steps (clickKebabIcon, clickDeleteOption,
deleteDashboardDeleteButton, emptyState) operate on the single intended
dashboard.

---

Nitpick comments:
In `@web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts`:
- Around line 73-76: The duplicated two-step navigation using
nav.sidenav.clickNavLink(['Observe', 'Alerting']) followed by
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']) should be extracted
into a small helper (e.g., returnToDashboardsPerses or goToDashboardsPerses) and
called from both places where it repeats; update the calls that currently
perform the two-step sequence (the lines invoking nav.sidenav.clickNavLink with
['Observe','Alerting'] and ['Observe','Dashboards (Perses)']) to a single call
to the new helper to centralize the behavior and reduce duplication.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts`:
- Around line 67-69: Replace the two hard-coded cy.wait(2000) calls by relying
on explicit UI assertions: keep the existing
cy.byPFRole('dialog').find('button').contains('Cancel').should('be.visible').click({
force: true }) but remove the pre-click wait, and after the click assert the
dialog has closed (e.g., cy.byPFRole('dialog').should('not.exist') or
should('not.be.visible')) or assert the expected post-cancel state (a specific
element appears/disappears or URL changes) so the test synchronizes on UI state
instead of timeouts; update the code referencing cy.byPFRole('dialog') and the
Cancel button accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 65c31440-367e-4770-b822-aad7914f4997

📥 Commits

Reviewing files that changed from the base of the PR and between 337dbdc and b0f33ff.

📒 Files selected for processing (18)
  • web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user4.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user6.cy.ts
  • web/cypress/fixtures/coo/coo141_perses/import/acm-vm-status.json
  • web/cypress/fixtures/perses/constants.ts
  • web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts
  • web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/views/perses-dashboards-create-dashboard.ts
  • web/cypress/views/perses-dashboards-import-dashboard.ts
  • web/cypress/views/perses-dashboards-list-dashboards.ts
  • web/cypress/views/perses-dashboards.ts
  • web/src/components/data-test.ts
💤 Files with no reviewable changes (1)
  • web/cypress/views/perses-dashboards.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • web/cypress/views/perses-dashboards-list-dashboards.ts
  • web/cypress/views/perses-dashboards-import-dashboard.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user6.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (1)
web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts (1)

479-494: ⚠️ Potential issue | 🟠 Major

Delete flow is still prefix-based and flaky; use the exact generated dashboard name.

This still depends on 'Testing Dashboard - UP' prefix matching and can target the wrong row if stale dashboards exist. Please persist the exact generated name from the create test and delete by that exact value.

Proposed fix
 export function testCOORBACPersesTestsDevUser1(perspective: PerspectiveConfig) {
+  let createdDashboardName: string | undefined;

   it(`5.${perspective.name} perspective - Create Dashboard with panel groups, panels and variables`, () => {
     let dashboardName = 'Testing Dashboard - UP ';
     let randomSuffix = Math.random().toString(5);
     dashboardName += randomSuffix;
+    createdDashboardName = dashboardName;
     ...
   });

   it(`9.${perspective.name} perspective - Delete dashboard`, () => {
     ...
-    listPersesDashboardsPage.filter.byName('Testing Dashboard - UP');
+    expect(createdDashboardName, 'created dashboard name from test 5').to.be.a('string');
+    listPersesDashboardsPage.filter.byName(createdDashboardName as string);
     listPersesDashboardsPage.countDashboards('1');
     ...
-    listPersesDashboardsPage.filter.byName('Testing Dashboard - UP');
+    listPersesDashboardsPage.filter.byName(createdDashboardName as string);
     listPersesDashboardsPage.countDashboards('0');
   });
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts` around lines 479 -
494, The delete flow currently filters by the static prefix 'Testing Dashboard -
UP' which is flaky; update the test to use the exact generated dashboard name
saved during the create step (store it as a Cypress alias or test context
variable) and use that value when calling
listPersesDashboardsPage.filter.byName(generatedName) and
listPersesDashboardsPage.countDashboards(expectedCount); ensure the exact name
is used for the kebab/delete sequence (listPersesDashboardsPage.clickKebabIcon,
clickDeleteOption, deleteDashboardDeleteButton, emptyState) so the delete
targets the exact row rather than a prefix match.
🧹 Nitpick comments (2)
web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts (1)

216-216: Consider replacing hardcoded waits with explicit assertions.

Multiple cy.wait(5000) and cy.wait(2000) calls throughout the file can lead to flaky tests. While these are pre-existing and outside this PR's scope, consider replacing them with explicit assertions or using Cypress's built-in retry-ability (e.g., cy.get().should() patterns) to wait for specific conditions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts` at line 216,
Replace hardcoded cy.wait(5000)/cy.wait(2000) calls with explicit assertions or
network waits: locate the occurrences of cy.wait(5000) (and cy.wait(2000)) in
the test file and replace them with targeted checks such as
cy.get('<appropriate-selector>').should('<condition>') or by intercepting
network requests with cy.intercept(...) and using cy.wait('@alias') to wait for
the actual condition; update surrounding test steps (e.g., where the test
expects a UI element or API response) to use these selectors/aliases so
Cypress’s built-in retry will handle timing instead of fixed sleeps.
web/cypress/views/perses-dashboards-create-dashboard.ts (1)

67-67: Remove the fixed wait and rely on visibility assertion instead.

The cy.wait(2000) before the Cancel button visibility check is unnecessary. Cypress will wait (up to the default 4000ms timeout) for the element to become visible via the .should('be.visible') assertion, making the fixed delay redundant.

♻️ Proposed fix
-    cy.wait(2000);
     cy.byPFRole('dialog').find('button').contains('Cancel').should('be.visible').click({ force: true });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts` at line 67, Remove
the hard-coded cy.wait(2000) call and rely on Cypress's built-in retry by
asserting visibility on the Cancel button instead; delete the cy.wait(2000) line
and ensure the subsequent check uses a visibility assertion like cy.get(... or
cy.contains('Cancel')).should('be.visible') (or add an explicit timeout option
if the element sometimes takes longer, e.g. .should('be.visible', { timeout:
10000 })), so the test no longer depends on a fixed delay.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts`:
- Around line 73-74: After each nav.sidenav.clickNavLink(['Observe', 'Dashboards
(Perses)']) call, add deterministic page-ready assertions before interacting
with dashboard-list controls: call titleShouldHaveText('Dashboards') and
shouldBeLoaded() (or the existing page load helper) to ensure the Dashboards
page is fully loaded; update both occurrences (the one near
nav.sidenav.clickNavLink at lines noted in the review) so subsequent
dashboard-list interactions run only after these assertions pass.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts`:
- Line 60: The helper assertDuplicatedNameValidation was changed to a
zero-argument function but some call sites still pass dashboardName; update
those call sites to call assertDuplicatedNameValidation() with no arguments.
Locate the two places in the test support files where
assertDuplicatedNameValidation(dashboardName) is invoked and remove the
dashboardName parameter so the calls match the new signature.
- Line 62: Scope the duplicate-name error assertion to the active create-dialog
instead of using a global cy.get. Replace the global
cy.get(Classes.PersesDuplicateDashboardNameError)... call with a scoped query
that first selects the active create dialog (e.g. the dialog selector used by
persesCreateDashboard such as Classes.PersesCreateDialog or the dialog data-test
attribute) and then .within() or .find() the
Classes.PersesDuplicateDashboardNameError element, asserting it has text
persesCreateDashboard.DIALOG_DUPLICATED_NAME_BKD_VALIDATION and is visible; this
ensures the check only matches the error inside the active dialog and avoids
unrelated alerts causing flaky/false positives.

In `@web/src/components/data-test.ts`:
- Line 223: Update the PersesDuplicateDashboardNameError selector to include the
PF5 fallback so it matches the same alert title element as
SilenceAlertTitle/SilenceAlertDescription; locate the
PersesDuplicateDashboardNameError selector in data-test.ts and change its value
to include both the PF6 and PF5 class variants (e.g., add the PF5 alert title
class alongside '.pf-v6-c-alert__title') so the selector coverage is consistent
across versions.

---

Duplicate comments:
In `@web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts`:
- Around line 479-494: The delete flow currently filters by the static prefix
'Testing Dashboard - UP' which is flaky; update the test to use the exact
generated dashboard name saved during the create step (store it as a Cypress
alias or test context variable) and use that value when calling
listPersesDashboardsPage.filter.byName(generatedName) and
listPersesDashboardsPage.countDashboards(expectedCount); ensure the exact name
is used for the kebab/delete sequence (listPersesDashboardsPage.clickKebabIcon,
clickDeleteOption, deleteDashboardDeleteButton, emptyState) so the delete
targets the exact row rather than a prefix match.

---

Nitpick comments:
In `@web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts`:
- Line 216: Replace hardcoded cy.wait(5000)/cy.wait(2000) calls with explicit
assertions or network waits: locate the occurrences of cy.wait(5000) (and
cy.wait(2000)) in the test file and replace them with targeted checks such as
cy.get('<appropriate-selector>').should('<condition>') or by intercepting
network requests with cy.intercept(...) and using cy.wait('@alias') to wait for
the actual condition; update surrounding test steps (e.g., where the test
expects a UI element or API response) to use these selectors/aliases so
Cypress’s built-in retry will handle timing instead of fixed sleeps.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts`:
- Line 67: Remove the hard-coded cy.wait(2000) call and rely on Cypress's
built-in retry by asserting visibility on the Cancel button instead; delete the
cy.wait(2000) line and ensure the subsequent check uses a visibility assertion
like cy.get(... or cy.contains('Cancel')).should('be.visible') (or add an
explicit timeout option if the element sometimes takes longer, e.g.
.should('be.visible', { timeout: 10000 })), so the test no longer depends on a
fixed delay.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e0279463-1092-44f3-843f-b29f898657c8

📥 Commits

Reviewing files that changed from the base of the PR and between b0f33ff and 0cd40de.

📒 Files selected for processing (19)
  • web/cypress/e2e/perses/00.coo_bvt_perses_admin_1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user4.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user6.cy.ts
  • web/cypress/fixtures/coo/coo141_perses/import/acm-vm-status.json
  • web/cypress/fixtures/perses/constants.ts
  • web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts
  • web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user3.cy.ts
  • web/cypress/support/perses/99.coo_rbac_perses_user5.cy.ts
  • web/cypress/views/perses-dashboards-create-dashboard.ts
  • web/cypress/views/perses-dashboards-import-dashboard.ts
  • web/cypress/views/perses-dashboards-list-dashboards.ts
  • web/cypress/views/perses-dashboards.ts
  • web/src/components/data-test.ts
💤 Files with no reviewable changes (1)
  • web/cypress/views/perses-dashboards.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • web/cypress/support/perses/00.coo_bvt_perses_admin_1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user2.cy.ts
  • web/cypress/views/perses-dashboards-import-dashboard.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user6.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user1.cy.ts
  • web/cypress/e2e/perses/99.coo_rbac_perses_user3.cy.ts

Comment on lines +73 to +74
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add explicit page-ready assertions after re-navigation to reduce flake.

Line 73–74 and Line 125–126 re-route through side nav and then immediately interact with dashboard-list controls. Add a deterministic post-nav check (titleShouldHaveText('Dashboards') + shouldBeLoaded()) before continuing.

♻️ Suggested refactor
 export function testCOOListPersesNamespace(perspective: PerspectiveConfig) {
+  const goToPersesDashboards = () => {
+    nav.sidenav.clickNavLink(['Observe', 'Alerting']);
+    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    commonPages.titleShouldHaveText('Dashboards');
+    listPersesDashboardsPage.shouldBeLoaded();
+  };
+
   it(`1.${perspective.name} perspective - List Dashboards (Perses) page`, () => {
@@
-    nav.sidenav.clickNavLink(['Observe', 'Alerting']);
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    goToPersesDashboards();
@@
   it(`2.${perspective.name} perspective - Duplicate from a project to another, Rename and Delete`, () => {
@@
-    nav.sidenav.clickNavLink(['Observe', 'Alerting']);
-    nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
+    goToPersesDashboards();

Also applies to: 125-126

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/support/perses/01.coo_list_perses_admin_namespace.cy.ts` around
lines 73 - 74, After each nav.sidenav.clickNavLink(['Observe', 'Dashboards
(Perses)']) call, add deterministic page-ready assertions before interacting
with dashboard-list controls: call titleShouldHaveText('Dashboards') and
shouldBeLoaded() (or the existing page load helper) to ensure the Dashboards
page is fully loaded; update both occurrences (the one near
nav.sidenav.clickNavLink at lines noted in the review) so subsequent
dashboard-list interactions run only after these assertions pass.

},

assertDuplicatedNameValidation: (dashboardName: string) => {
assertDuplicatedNameValidation: () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find all call sites and verify argument count manually from matches
rg -nP '\bassertDuplicatedNameValidation\s*\(' web/cypress

Repository: openshift/monitoring-plugin

Length of output: 352


Update call sites to match new zero-argument signature.

assertDuplicatedNameValidation is now defined without parameters, but 2 call sites still pass dashboardName:

  • web/cypress/support/perses/03.coo_create_perses_admin.cy.ts:75
  • web/cypress/support/perses/03.coo_create_perses_admin.cy.ts:92

Remove the argument from both calls to fix TypeScript type errors.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts` at line 60, The
helper assertDuplicatedNameValidation was changed to a zero-argument function
but some call sites still pass dashboardName; update those call sites to call
assertDuplicatedNameValidation() with no arguments. Locate the two places in the
test support files where assertDuplicatedNameValidation(dashboardName) is
invoked and remove the dashboardName parameter so the calls match the new
signature.

} else {
cy.byPFRole('dialog').find(Classes.PersesCreateDashboardDashboardNameError).should('have.text', `${persesCreateDashboard.DIALOG_DUPLICATED_NAME_PF_VALIDATION_PREFIX}"${dashboardName}"${persesCreateDashboard.DIALOG_DUPLICATED_NAME_PF_VALIDATION_SUFFIX}`).should('be.visible');
}
cy.get(Classes.PersesDuplicateDashboardNameError).should('have.text', persesCreateDashboard.DIALOG_DUPLICATED_NAME_BKD_VALIDATION).should('be.visible');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Scope duplicate-name error assertion to the active dialog.

Global cy.get(...) can match unrelated alert titles and cause flaky or false-positive assertions.

♻️ Proposed fix
-    cy.get(Classes.PersesDuplicateDashboardNameError).should('have.text', persesCreateDashboard.DIALOG_DUPLICATED_NAME_BKD_VALIDATION).should('be.visible');
+    cy.byPFRole('dialog')
+      .find(Classes.PersesDuplicateDashboardNameError)
+      .should('have.text', persesCreateDashboard.DIALOG_DUPLICATED_NAME_BKD_VALIDATION)
+      .should('be.visible');
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cy.get(Classes.PersesDuplicateDashboardNameError).should('have.text', persesCreateDashboard.DIALOG_DUPLICATED_NAME_BKD_VALIDATION).should('be.visible');
cy.byPFRole('dialog')
.find(Classes.PersesDuplicateDashboardNameError)
.should('have.text', persesCreateDashboard.DIALOG_DUPLICATED_NAME_BKD_VALIDATION)
.should('be.visible');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/cypress/views/perses-dashboards-create-dashboard.ts` at line 62, Scope
the duplicate-name error assertion to the active create-dialog instead of using
a global cy.get. Replace the global
cy.get(Classes.PersesDuplicateDashboardNameError)... call with a scoped query
that first selects the active create dialog (e.g. the dialog selector used by
persesCreateDashboard such as Classes.PersesCreateDialog or the dialog data-test
attribute) and then .within() or .find() the
Classes.PersesDuplicateDashboardNameError element, asserting it has text
persesCreateDashboard.DIALOG_DUPLICATED_NAME_BKD_VALIDATION and is visible; this
ensures the check only matches the error inside the active dialog and avoids
unrelated alerts causing flaky/false positives.

PersesCreateDashboardProjectDropdown: '.pf-v6-c-menu-toggle.pf-m-full-width.pf-m-typeahead',
PersesCreateDashboardProjectDropdown: 'button[class="pf-v6-c-menu-toggle__button"]',
PersesCreateDashboardDashboardNameError: '.pf-v6-c-helper-text__item-text',
PersesDuplicateDashboardNameError: '.pf-v6-c-alert__title',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify selector compatibility conventions in this file
rg -n "PersesDuplicateDashboardNameError|SilenceAlertTitle|pf-v5-c-alert__title|pf-v6-c-alert__title" web/src/components/data-test.ts

Repository: openshift/monitoring-plugin

Length of output: 209


🏁 Script executed:

# Get more context around line 223 and 227 to understand the selector pattern
sed -n '215,235p' web/src/components/data-test.ts

Repository: openshift/monitoring-plugin

Length of output: 1645


🏁 Script executed:

# Search for all selectors in the file to understand the general pattern with PF versions
rg -n "pf-v[56]-c-" web/src/components/data-test.ts | head -30

Repository: openshift/monitoring-plugin

Length of output: 2375


Add PF5 fallback to the alert-title selector for consistency with the file's cross-version support pattern.

The selector at line 223 uses only .pf-v6-c-alert__title, while the corresponding SilenceAlertTitle selector at line 227 and other alert selectors in the file include both PF6 and PF5 variants (e.g., SilenceAlertDescription at line 228). Both reference the same alert title element and should maintain consistent selector coverage.

♻️ Proposed fix
-  PersesDuplicateDashboardNameError: '.pf-v6-c-alert__title',
+  PersesDuplicateDashboardNameError: '.pf-v6-c-alert__title, .pf-v5-c-alert__title',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
PersesDuplicateDashboardNameError: '.pf-v6-c-alert__title',
PersesDuplicateDashboardNameError: '.pf-v6-c-alert__title, .pf-v5-c-alert__title',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/components/data-test.ts` at line 223, Update the
PersesDuplicateDashboardNameError selector to include the PF5 fallback so it
matches the same alert title element as
SilenceAlertTitle/SilenceAlertDescription; locate the
PersesDuplicateDashboardNameError selector in data-test.ts and change its value
to include both the PF6 and PF5 class variants (e.g., add the PF5 alert title
class alongside '.pf-v6-c-alert__title') so the selector coverage is consistent
across versions.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 17, 2026

@etmurasaki: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants